package lib.streaming;

import com.google.common.base.Stopwatch;
import org.junit.Test;

import java.util.concurrent.TimeUnit;
import java.util.function.Function;

/**
 * Created by apple on 2018/7/1.
 */
public class TestForkAndJoinSumCal {

    @Test
    public void test() {
        long i = 10000000;
        Stopwatch stopWatch = Stopwatch.createStarted();
        Function<Long, Long> adder = ForkJoinSumCalculator::forkJoinSum;
        adder.apply(i);
        stopWatch.stop();
        System.out.println(stopWatch.elapsed(TimeUnit.MILLISECONDS));
    }
}
